<template>
  <el-dialog v-model="show" class="rounded-[15px]" title="选择链接">
    <div class="flex flex-row">
      <el-scrollbar :height="400" class="w-[200px] border-r border-solid border-[#e0e0e0]"
        ><el-tree :data="routeList" :props="defaultProps"> </el-tree
      ></el-scrollbar>
    </div>
    <div></div>
  </el-dialog>
</template>

<script setup lang="ts">
import { onBeforeMount, ref } from "vue";
import { getRoutes } from "@/api/modules/shop";
const show = ref(false);

const open = () => {
  show.value = true;
};

// 路由
const routeList = ref([]);
const defaultProps = {
  label: "name"
};

// 获取页面
const getRoutesList = async () => {
  try {
    const { data } = await getRoutes({ pageSize: 9999, pageNum: 1 });
    routeList.value = data as any;
  } catch (error) {}
};

onBeforeMount(() => {
  getRoutesList();
});

defineExpose({ open });
</script>

<style></style>
